package 第8场_小白入门赛;

import java.util.Arrays;
import java.util.Comparator;
import java.io.*;
public class _02 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String arr[] = new String[n];
		for(int i = 0; i < n; i++) {
			arr[i] = br.readLine();
		}
		
		Arrays.sort(arr,new Comparator<Object>() {

			@Override
			public int compare(Object o1, Object o2) {
				// TODO Auto-generated method stub
				String s1 = (String)o1 + o2;
				String s2 = (String)o2 + o1;
				return s1.compareTo(s2);
			}
			
		});
		for(int i = 0; i < arr.length; i++) {
			System.out.print(arr[i]);
		}
		
	}
}
